@import './theme/default.less';
@c-border: @theme-stroke-5;
@c-blue: @theme-primary-1;
@c-light-blue: @theme-primary-4;
@c-blue-hover: @theme-primary-6;

.zent-cascader {
  display: inline-block;

  &.open {
    .zent-cascader__select-text {
      border-color: @c-blue;
      box-shadow: 0 1px 1px @c-light-blue;

      .zenticon {
        transform: rotate(180deg) scale(0.5);
      }
    }
  }

  &__select {
    cursor: pointer;
    display: inline-block;
    font-size: 0;
    position: relative;
    text-align: left;
    user-select: none;
    width: 260px;
    vertical-align: middle;

    &-text {
      box-sizing: border-box;
      border: 1px solid @c-border;
      border-radius: 2px;
      display: inline-block;
      min-height: 30px;
      line-height: 1.5;
      max-height: 76px;
      padding: 5px 30px 5px 10px;
      transition: border-color 0.25s;
      width: 100%;
      background-color: @theme-stroke-10;
      position: relative;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 12px;

      &-content {
        line-height: inherit;
      }

      &.is-placeholder {
        color: @theme-stroke-4;
      }

      .zenticon {
        margin-top: -6px;
        position: absolute;
        right: 10px;
        top: 50%;
        transition: transform 0.25s;
        font-size: 12px;
        transform: scale(0.5);
      }
    }
  }

  &__menu {
    display: inline-block;
    vertical-align: top;
    min-width: 111px;
    height: 180px;
    list-style: none;
    margin: 0;
    padding: 0;
    border-right: 1px solid @theme-stroke-7;
    overflow: auto;

    &-item {
      font-size: 12px;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.3s;
      position: relative;
      height: 30px;
      line-height: 30px;
      text-align: left;
      color: @theme-stroke-3;
      padding-left: 10px;
      padding-right: 30px;
      box-sizing: border-box;

      &-icon {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: @theme-stroke-5;
        font-size: 8px;
      }

      &-loading {
        width: 12px;
        height: 12px;
        margin-top: -6px;
        position: absolute;
        display: inline-block;
        animation: rotate 1s infinite linear;
        border: 1px solid @theme-stroke-5;
        border-radius: 50%;
        right: 10px;
        top: 50%;
        border-top-color: transparent;
        box-sizing: border-box;
      }

      &:hover {
        background: @c-blue-hover;
      }

      &.active {
        background: @theme-stroke-9;
        font-weight: 600;
      }
    }
  }

  &__list {
    font-size: 0;
    padding: 10px 4px;
    min-height: 80px;

    &-item {
      display: inline-block;
      line-height: 30px;
      height: 30px;
      width: 108px;
      box-sizing: border-box;
    }

    &-link {
      cursor: pointer;
      display: inline-block;
      font-size: 12px;
      padding: 0 5px;
      line-height: 18px;
      vertical-align: middle;
      max-width: 98px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;

      &:hover {
        background: @c-blue-hover;
      }

      &.active {
        background: @c-blue;
        border-radius: 2px;
        color: @theme-stroke-10;
      }
    }
  }

  &__tabs {
    .zent-tabs {
      &-nav {
        margin-bottom: 0;
      }

      &-nav-content {
        height: auto;
      }

      &-tab {
        border-radius: 0;
        border-top: none;
        width: 80px;

        &:first-child {
          border-left: none;
          border-top: none;
        }
      }

      &-tab-inner {
        min-width: 80px;
      }
    }
  }

  &__popup {
    z-index: 2000;

    &-inner {
      background: @theme-stroke-10;
      width: 440px;
      box-shadow: 0 1px 4px @theme-mask-black-2;
      box-sizing: border-box;
      margin-top: 5px;

      &-menu {
        width: auto;
        white-space: nowrap;
      }
    }
  }

  &__loading {
    position: relative;
    vertical-align: middle;

    &-label {
      line-height: 16px;
      display: inline-block;
      vertical-align: middle;
    }

    &-icon {
      display: inline-block;
      position: relative;
      vertical-align: middle;
      height: 12px;
      width: 12px;
      border-radius: 50%;
      border: 1px solid @c-blue;
      margin-left: 5px;

      &:after {
        content: '';
        display: inline-block;
        position: absolute;
        height: 10px;
        width: 4px;
        background: white;
        animation: 1s linear rotate infinite;
        transform-origin: 8px 3px;
        left: -1px;
        top: 4px;
      }
    }
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}
